package com.strato.event.invm.v1_0_0.container;

import java.util.List;

import com.strato.annotation.osgi.v1_0_0.service.OsgiService;
import com.strato.base.osgi.v1_0_0.BundleUtil;
import com.strato.event.api.v1_0_0.Event;
import com.strato.event.api.v1_0_0.EventContainer;
import com.strato.event.api.v1_0_0.EventListener;
import com.strato.event.invm.v1_0_0.activator.Activator;

@OsgiService(id="invm")
public class InVMEventContainer implements EventContainer {

	@Override
	public void dispatch(Event event) {
		List<EventListener> listeners = BundleUtil.getCachedServices(Activator.getContext(), EventListener.class, null);
		for(EventListener listener:listeners){
			listener.on(event);
		}
	}

}
